package com.ssl.rms.service.impl;

import com.ssl.rms.entity.RoleMenu;
import com.ssl.rms.entity.RoleMenuExample;
import com.ssl.rms.mapper.RoleMenuMapper;
import com.ssl.rms.service.RoleMenuService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 描述：角色-菜单service实现类
 *
 * @author ssl
 * @create 2018/03/29 13:49
 */
@Service
public class RoleMenuServiceImpl implements RoleMenuService {
    private Logger logger = LoggerFactory.getLogger(getClass());
    @Autowired
    private RoleMenuMapper roleMenuMapper;

    /**
     * 根据角色查找拥有的菜单
     *
     * @param roleId
     * @return
     */
    @Override
    public List<RoleMenu> findMenus(Long roleId) {
        RoleMenuExample example = new RoleMenuExample();
        RoleMenuExample.Criteria criteria = example.createCriteria();
        criteria.andRoleEqualTo(roleId);
        return roleMenuMapper.selectByExample(example);
    }
}
